(function(){
	//手机端检测
	if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
		let box = document.getElementsByClassName('all_bg')[0];
		box.style.marginTop = 0;  //距离顶部距离为0
		box.style.width = '100%';  //宽度设置
		box.style.height = '100%';  //高度设置

		let canvas1 = document.getElementById('canvas1');
		let canvas2 = document.getElementById('canvas2');
		canvas1.style.width = '100%';
		canvas1.style.height = '100%';
		canvas2.style.width = '100%';
		canvas2.style.height = '100%';
	}

	var canvas1, vanvas2;  //canvas
	var ctx1, ctx2;  //画笔
	var lastframetime, diffframetime=0; //上一帧动画的时间，两帧的时间差
	var canvas_w, canvas_h;  //canvas的宽高
	var can2App, can1App;
	var ane; //海葵
	var fruit; //果实
	var bigFish, smallFish; //大鱼小鱼
	var mousex, mousey; //鼠标的横纵坐标值
	var globalAnimation;  //定时器
	var scoreObj;  //分数对象
	var smallWave, bigWave;  //波浪圆圈
	var dust, dustPic=[];  //漂浮物

	window.burtyang = {};
	
	burtyang.startGame = function(){
		burtyang.init();

		lastframetime = Date.now();
		burtyang.gameLoop();
	}

	burtyang.init = function(){
		//canvas1上绘制：大鱼、小鱼、显示文字、圆圈特效
		canvas1 = document.getElementById('canvas1');
		//canvas2上绘制：背景、海葵、果实
		canvas2 = document.getElementById('canvas2');
		ctx1 = canvas1.getContext("2d");
		ctx2 = canvas2.getContext('2d');
		ctx1.font = '20px Verdana';
		ctx1.textAlign = "center";  //文字居中

		canvas_w = canvas1.width;
		canvas_h = canvas1.height;

		//监听在画布1上的鼠标移动事件
		canvas1.addEventListener('mousemove', burtyang.onMouseMove , false);
		canvas1.addEventListener('click', burtyang.onClick , false);

		mousex = canvas_w * 0.5;
		mousey = canvas_h * 0.5;

		can2App.drawBackdround();  //画背景
		ane = new AneObject();  //海葵
		ane.init();
		fruit = new FruitObject();  //果实
		fruit.init();

		bigFish = new BigFish();  //大鱼
		bigFish.init();
		smallFish = new BabyFish();
		smallFish.init();

		scoreObj = new ScoreObj();
		scoreObj.init();

		smallWave = new SmallWave();  //小圆圈波浪实例
		smallWave.init();

		bigWave = new SmallWave(false);  //大圆圈波浪实例
		bigWave.init();

		dust = new DustObj();
		dust.init();
		for(var i=0; i<7; i++){  //初始化图片数组
			dustPic[i] = new Image();
			dustPic[i].src = './images/dust'+i+'.png';
		}


	}

	burtyang.gameLoop = function(){
		//当前帧绘制完成后，根据浏览器的性能和网络快慢决定绘制下一帧
		globalAnimation = requestAnimationFrame(burtyang.gameLoop);
		var now = Date.now();
		diffframetime = now - lastframetime; //两帧之间之间差(毫秒)
		lastframetime = now;
		if(diffframetime > 40){
			diffframetime = 40; //防止切换浏览器窗口,diff时间变长，果实增长无限大
		}

		//ctx2.clearRect(0, 0, canvas_w, canvas_h); //清除画布
		can2App.drawBackdround();//绘制背景
		ane.drawAne();  //绘制海葵
		computeFruit(); //监视果实数量
		fruit.drawfruit(); //绘制果实

		//先清除画布1
		ctx1.clearRect(0, 0, canvas_w, canvas_h);
		bigFish.draw();
		smallFish.draw();
		scoreObj.draw();
		smallWave.draw();
		bigWave.draw();
		dust.draw();
	}

	burtyang.onMouseMove = function(e){
		if(!scoreObj.gameOver){ //游戏未结束
			var event = e || window.event;
			mousex = event.offsetX;
			mousey = event.offsetY;
		}
	}

	burtyang.onClick = function(e){
		var event = e || window.event;
		if(scoreObj.gameOver){ //游戏结束了；
			let clientx = event.offsetX;
			let clienty = event.offsetY;
			if(canvas_w * 0.5-100<clientx && clientx<canvas_w * 0.5+100  
				&& canvas_h * 0.5< clienty && clienty< canvas_h * 0.5+35){

				scoreObj.gameOver = false;
				ane.init();
				fruit.init();
				bigFish.init();
				smallFish.init();
				scoreObj.init();
				smallWave.init();
				bigWave.init();
			}
		}else{
			mousex = event.offsetX;
			mousey = event.offsetY;
		}
	}

	/*****在画布2上绘制背景、海葵、果实******/
	can2App = {};
	can2App.drawBackdround= function(){
		var bigPic = new Image(canvas_w, canvas_h); //背景图片 
		bigPic.src = './images/background.jpg'; //背景图片
		//注： 必须使图片加载完毕后才能绘制，否则绘制无效
		ctx2.drawImage(bigPic, 0, 0, canvas_w, canvas_h);
	}

	/******************定义海葵类*****************/
	function AneObject(){
		this.num = 50;
		//开始点、控制点、结束点
		this.rootx = [];  //底部根的位置数组
		this.headx = [];  //头部x轴坐标位置数组
		this.heady = [];  //头部y轴坐标位置数组
		this.amp = [];  //振幅
		this.beat = 0;  //sin的角度

		//初始化
		this.init =function(){
			this.beat = 0;  //sin的角度
			for(var i=0; i<this.num; i++){
				this.rootx[i] = i*18+ Math.random()*30;
				this.headx[i] = this.rootx[i];
				this.heady[i] = canvas_h-400 + Math.random()*50;
				this.amp[i] = Math.random() *50 + 60;
			}
		}

		//绘制
		this.drawAne = function(){
			this.beat += diffframetime * 0.0008;
			var l = Math.sin(this.beat);
			ctx2.save();  //定义样式作用空间
			ctx2.globalAlpha = 0.7;  //透明度
			ctx2.lineWidth = 20;
			ctx2.lineCap = 'round';
			ctx2.strokeStyle = '#3b154e';
			for(var i = 0; i< this.num; i++){
				
				ctx2.beginPath();  //打断之前的点，重新开始
				ctx2.moveTo(this.rootx[i], canvas_h);     //起始点， 根部
				this.headx[i] = this.rootx[i] + l * this.amp[i];
				//ctx2.lineTo(this.rootx[i], canvas_h - this.heady[i]);  //控制点  和  结束点的x，y
				//绘制一条二次贝塞尔曲线quadraticCurveTo(控制点x坐标, 控制y坐标, 结束点x坐标, 结束点y坐标)
				//使控制点不动， 只需要使结束点摆动
				//console.log(this.rootx[i],canvas_h - this.heady[i]+100, endx, canvas_h - this.heady[i])
				ctx2.quadraticCurveTo(this.rootx[i],canvas_h - this.heady[i]+100, this.headx[i], canvas_h - this.heady[i])
				ctx2.stroke();
			}
			ctx2.restore(); //作用空间结束
		}
	}


	/************定义果实的类***************/
	function FruitObject(){
		this.num = 30;
		this.x = [];  //x轴坐标
		this.y = [];  //y轴坐标
		this.aneNO = [];  //找到海葵的标号
		this.size = []; //果实大小(直径)
		this.type = [];   //果实的类型
		this.speed = [];  //果实漂浮速度
		this.grow = [];  //果实是否长大
		this.alive = []; //bool,是否活着
		this.orange = new Image();  
		this.blue = new Image();  

		this.init = function(){
			this.orange.src = './images/fruit.png';
			this.blue.src = './images/blue.png';
			for(var i=0; i<this.num; i++){
				this.x[i] = this.y[i] = 0;
				this.speed[i] = Math.random() * 0.015+ 0.0005;
				this.alive[i] = false; //休眠状态
				this.grow[i] = false; //未长大
				this.type[i] = "";
				this.size[i] = 0;
				this.aneNO[i] = 0;
			}
			return this;
		}

		this.drawfruit = function(){
			for(var i=0; i<this.num; i++){
				if(this.alive[i]){
					//找到一个海葵， 然后成长，漂浮
					if(this.size[i]<= 16){ //长大状态
						this.grow[i] = false;
						this.size[i] += this.speed[i] *diffframetime*0.8;
						//使果实未长大时随海葵摆动
						this.x[i] = ane.headx[this.aneNO[i]];
						this.y[i] = canvas_h - ane.heady[this.aneNO[i]];
					}else{ //已经长大，向上漂浮
						this.grow[i] = true;
						this.y[i] -= this.speed[i]*5 *diffframetime;
					}
					var fruit_pic = this.type[i]=='blue'? this.blue: this.orange;
					ctx2.drawImage(fruit_pic, this.x[i]-fruit_pic.width*0.5, this.y[i]-fruit_pic.height*0.5
									, this.size[i], this.size[i]);
					if(this.y[i] < 8){
						this.alive[i] = false;
					}
				}
			}
			return this;
		}

		//果实出生，随机找一根海葵
		this.born = function(i){
			var aneId = Math.floor(Math.random()* ane.num);
			this.aneNO[i] = aneId; //海藻的标号
			this.x[i] = ane.headx[aneId]; //果实横坐标
			this.y[i] = canvas_h- ane.heady[aneId]; //果实纵坐标
			this.size[i] = 0;
			this.alive[i] = true;
			var flag = Math.random(); //随机生成橙色球或者蓝色球
			if(flag < 0.2){
				this.type[i] = "blue";
			}else{
				this.type[i] = "orange";
			}
			return this;
		}

		//果实出界，死亡
		this.dead = function(){
			this.alive[i] = false;
			return this;
		}
	}
	//计算屏幕上的果实数量
	function computeFruit(){
		var count = 0;
		for(var i=0; i<fruit.num; i++){
			if(fruit.alive[i]){
				count ++;
			}
		}
		if(count <15){
			bornFruit();  //出生一个果实
			return false;
		}
	}

	//循环30个果实，如果状态为false，则让它出生
	function bornFruit(){
		for(var i = 0;i< fruit.num; i++){
			if(!fruit.alive[i]){
				fruit.born(i);
				return false;
			}
		}
	}




	/*************画布1上绘制东西**********************/
	/*************定义大鱼类*****************/
	function BigFish(){
		this.x = canvas_w * 0.5;
		this.y = canvas_h * 0.5;
		this.init = function(){
			this.angle = 0;  //大鱼的角度

			this.bigEyeArr = [];  //大鱼眼睛图片
			this.bigEyeIndex = 0;
			this.bigEyeTimer = 0;
			this.bigEyeInterval = 1000;

			this.bigBodyBlueArr = []; //大鱼的蓝色身体
			this.bigBodyOrangeArr = []; //大鱼的橙色身体
			this.bigBodyIndex =0;
			this.bigBodyTimer = 0;

			this.bigTailArr = [] //大鱼的尾巴
			this.bigTailIndex = 0;
			this.bigTailTimer = 0;
			//眼睛
			for(var i=0; i<2; i++){
				this.bigEyeArr[i] = new Image();
				this.bigEyeArr[i].src = './images/bigEye'+i+'.png';
			}
			//身体
			for(var i=0; i<8; i++){
				this.bigBodyBlueArr[i] = new Image();
				this.bigBodyBlueArr[i].src = './images/bigEatBlue'+i+'.png';
				this.bigBodyOrangeArr[i] = new Image();
				this.bigBodyOrangeArr[i].src = './images/bigEat'+i+'.png';
			}
			//尾巴
			for(var i=0; i<8; i++){
				this.bigTailArr[i] = new Image();
				this.bigTailArr[i].src = './images/bigTail'+i+'.png';
			}
		}

		this.draw = function(){
			//调用函数 lerp,让大鱼的坐标值倾向于鼠标位置，然后绘制大鱼
			this.x = lerpDistance(mousex, this.x, 0.96);
			this.y = lerpDistance(mousey, this.y, 0.98);

			//尾巴眨动
			this.bigTailTimer += diffframetime;
			if(this.bigTailTimer > 50){
				this.bigTailTimer %= 50;
				this.bigTailIndex ++;
				this.bigTailIndex %= 8;
			}

			//眼睛眨动
			this.bigEyeTimer += diffframetime;
			if(this.bigEyeTimer > this.bigEyeInterval){
				this.bigEyeTimer %= this.bigEyeInterval;
				this.bigEyeIndex ++;
				this.bigEyeIndex %= 2;

				if(this.bigEyeIndex ===0){  //下一帧睁开, 使之为2~3秒
					this.bigEyeInterval = Math.random()*1000 + 2000;
				}else{
					this.bigEyeInterval = 200;
				}
			}
			

			//lerp angle    让大鱼的角度倾向于鼠标的角度
			var deltaX = mousex - this.x;  //横坐标差
			var deltaY = mousey - this.y;  //纵坐标差
			var beta = Math.atan2(deltaY, deltaX) + Math.PI;    //反正切函数，获得目标角度
			this.angle = lerpAngle(beta, this.angle, 0.6);    //获得每一次旋转的角度



			ctx1.save();
			ctx1.translate(this.x, this.y); //切换原点位置
			ctx1.rotate(this.angle);  //旋转角度,旋转画布
			var bigTailImage = this.bigTailArr[this.bigTailIndex];
			ctx1.drawImage(bigTailImage, -bigTailImage.width*0.5+30, -bigTailImage.height*0.5);
			var bigBodyImage;
			if(scoreObj.doubleNum === 1){  //倍数为1表示橙色果实
				bigBodyImage = this.bigBodyOrangeArr[this.bigBodyIndex];
			}else{
				bigBodyImage = this.bigBodyBlueArr[this.bigBodyIndex];
			}
			ctx1.drawImage(bigBodyImage, -bigBodyImage.width*0.5, -bigBodyImage.height*0.5);
			var bigEyeImage = this.bigEyeArr[this.bigEyeIndex];
			ctx1.drawImage(bigEyeImage, -bigEyeImage.width*0.5, -bigEyeImage.height*0.5);
			
			ctx1.restore();

			this.bigFruitCollision();
			this.bigBabyCollision();
		}

		//判断大鱼跟果实的距离,碰撞检测
		this.bigFruitCollision = function(){
			if(!scoreObj.gameOver){
				for(var i=0; i< fruit.num; i++){
					if(fruit.alive[i] && fruit.grow[i]){ //果实还存在并且已经长成熟
						//碰撞检测
						var distance = calLength2(this.x, this.y, fruit.x[i], fruit.y[i]);
						if(distance < 900){ //如果两点之间距离小于30
							fruit.alive[i] = false;
							scoreObj.fruitNum++;
							bigFish.bigBodyIndex++;
							if(bigFish.bigBodyIndex>7){
								bigFish.bigBodyIndex = 7;
							}
							if(fruit.type[i] === 'blue'){ //蓝色果实
								scoreObj.doubleNum = 2;
							}else{
								scoreObj.doubleNum = 1;
							}
							//产生圆圈效果
							smallWave.born(i);
						}
					}
				}
			}
		}

		//判断大鱼跟小鱼的距离，检测碰撞
		this.bigBabyCollision = function(){
			if(!scoreObj.gameOver && scoreObj.fruitNum> 0){ //游戏未结束并且果实数量大于0
				var distance = calLength2(this.x, this.y, smallFish.x, smallFish.y);
				if(distance < 900){ //如果距离小于30
					smallFish.babyBodyIndex = 0; //使之恢复初始颜色
					bigFish.bigBodyIndex = 0; //使大鱼的身体颜色也恢复到初始颜色
					scoreObj.computeScore();
					bigWave.born();
				}
			}
		}
	}


	/*************定义小鱼类******************/
	function BabyFish(){
		this.x = canvas_w * 0.5- 50;
		this.y = canvas_h * 0.5+ 50;
		

		this.init = function(){
			this.angle = 0;  //小鱼的角度

			this.babyTailArr = [];  //小鱼尾巴数组图片
			this.babyTailTimer = 0;  //计时器
			this.babyTailIndex = 0;  //尾巴图片数组的下标

			this.babyBodyArr = [];  //小鱼身体数组图片
			this.babyBodyTimer = 0;  //计时器
			this.babyBodyIndex = 0;  //身体图片数组的下标

			this.babyEyeArr = [];  //小鱼眼睛数组图片
			this.babyEyeTimer = 0;  //计时器
			this.babyEyeIndex = 0;  //眼睛图片数组的下标
			this.babyEyeInterval= 1000;  //初始化间隔时间为1秒
			for(var i=0; i<8; i++){  //初始化小鱼尾巴数组图片
				this.babyTailArr[i] = new Image();  //小鱼的尾巴
				this.babyTailArr[i].src = './images/babyTail'+i+'.png';
			}
			for(var i=0; i<2; i++){  //初始化小鱼眼睛数组图片
				this.babyEyeArr[i] = new Image();  //小鱼的眼睛
				this.babyEyeArr[i].src = './images/babyEye'+i+'.png';
			}
			for(var i=0; i<20; i++){  //初始化小鱼身体数组图片
				this.babyBodyArr[i] = new Image();  //小鱼的身体
				this.babyBodyArr[i].src = './images/babyFade'+i+'.png';
			}

		}

		this.draw = function(){
			//调用函数 lerp,让大鱼的坐标值倾向于鼠标位置，然后绘制大鱼
			this.x = lerpDistance(bigFish.x, this.x, 0.98);
			this.y = lerpDistance(bigFish.y, this.y, 0.99);

			//尾巴摆动
			this.babyTailTimer += diffframetime;
			if(this.babyTailTimer > 50){  //50毫秒摆动一次
				this.babyTailIndex = (this.babyTailIndex + 1) % 8;   //获得尾巴图片数组下标
				this.babyTailTimer %= 50;
			}

			//眨眼睛
			this.babyEyeTimer += diffframetime;  
			if(this.babyEyeTimer > this.babyEyeInterval){   //如果计数器大于时间间隔,数组下标加1
				this.babyEyeIndex = (this.babyEyeIndex + 1) % 2;
				this.babyEyeTimer %= this.babyEyeInterval;

				if(this.babyEyeIndex == 0){       //如果下一帧是闭眼睛状态，时间间隔为2－3秒
					this.babyEyeInterval = Math.random() * 1500 + 1500;
				}else{
					this.babyEyeInterval = 200;
				}
			}

			//身体变白
			this.babyBodyTimer += diffframetime;
			if(this.babyBodyTimer > 550){  //没隔一定时间变白
				this.babyBodyIndex += 1;
				this.babyBodyTimer %= 550;
				if(this.babyBodyIndex > 19){
					this.babyBodyIndex = 19;
					//game over
					scoreObj.gameOver = true;
					//取消鼠标移动监听事件
					//canvas1.removeEventListener('mousemove', burtyang.onMouseMove , false);
					//等待2秒后停止连续渲染
					// setTimeout(function(){
					// 	cancelAnimationFrame(globalAnimation);
					// }, 2000);
				}
			}

			//lerp angle    让小鱼的角度倾向于大鱼的角度
			var deltaX = bigFish.x - this.x;  //横坐标差
			var deltaY = bigFish.y - this.y;  //纵坐标差
			var beta = Math.atan2(deltaY, deltaX) + Math.PI;    //反正切函数，获得目标角度
			this.angle = lerpAngle(beta, this.angle, 0.6);    //获得每一次旋转的角度

			ctx1.save();
			ctx1.translate(this.x, this.y); //切换原点位置
			ctx1.rotate(this.angle);  //旋转角度

			var babyTailImage = this.babyTailArr[this.babyTailIndex];
			ctx1.drawImage(babyTailImage, -babyTailImage.width*0.5+24, -babyTailImage.height*0.5);

			var babyBodyImage = this.babyBodyArr[this.babyBodyIndex];
			ctx1.drawImage(babyBodyImage, -babyBodyImage.width*0.5, -babyBodyImage.height*0.5);

			var babyEyeImage = this.babyEyeArr[this.babyEyeIndex];
			ctx1.drawImage(babyEyeImage, -babyEyeImage.width*0.5, -babyEyeImage.height*0.5);
			ctx1.restore();
		}
	}

	/*************定义数据类*********************/
	function ScoreObj(){
		this.init = function(){
			this.fruitNum = 0;  //大鱼吃到的果实数量
			this.doubleNum = 1; //计算分数的倍数
			this.score = 0; //分值
			this.strength = 10;
			this.gameOver = false;  //游戏未结束
			this.alpha = 0;
		}

		this.draw = function(){
			ctx1.save();
			ctx1.fillStyle = 'white';
			ctx1.fillText("分数:"+this.score, canvas_w*0.5, canvas_h-20);
			ctx1.fillText("果实数量:"+this.fruitNum, canvas_w*0.5, canvas_h-50);
			ctx1.fillText("倍数:"+this.doubleNum, canvas_w*0.5, canvas_h-80);

			if(this.gameOver){ //游戏结束
				this.alpha += diffframetime * 0.0005;
				this.alpha = this.alpha>1 ? 1 : this.alpha;
				ctx1.shadowBlur = 10;
				ctx1.shadowColor = "white";
				ctx1.fillStyle = "rgba(255,255,255,+"+this.alpha+")";
				ctx1.fillText("GAME OVER", canvas_w * 0.5, canvas_h * 0.5 - 25);
				ctx1.fillText("CLICK TO RESTART", canvas_w * 0.5, canvas_h * 0.5 + 25);

				ctx1.beginPath();
				ctx1.lineWidth = 2;
				ctx1.strokeStyle = 'white';
				ctx1.rect(canvas_w * 0.5-100, canvas_h * 0.5, 200, 35);
				ctx1.stroke();
			}
			ctx1.restore();

		}

		//计算分值
		this.computeScore = function(){
			this.score += this.fruitNum * this.doubleNum;
			this.fruitNum = 0;
			this.doubleNum = 1;
		}
	}


	/***************大鱼吃果实产生圆圈、大鱼喂小鱼光环类********************/
	function SmallWave(small=true){
		this.num = 10;  //圆圈个数
		this.x = [];  //波浪的x坐标
		this.y = [];
		this.status = [];  //当前圆圈的使用状态
		this.r = [];  //半径
		this.radius = 60;  //圆圈最大半径
		this.changeBate = 0.04;  //半径增长比率
		this.small = small;
		this.lineWidth = 3;

		this.init = function(){
			if(!this.small){  //大光环
				this.num = 5;
				this.radius = 100;
				this.changeBate = 0.08;
				this.lineWidth = 4;
			}
			for(var i=0; i<this.num; i++){
				this.x[i] = canvas_w * 0.5;
				this.y[i] = canvas_h * 0.5;
				this.status[i] = false; //未被使用
				this.r[i] = 0;
			}
		}

		this.draw = function(){
			ctx1.save();
			ctx1.lineWidth = this.lineWidth;
			for(var i=0; i<this.num; i++){
				if(this.status[i]){  //被使用，则绘制
					this.r[i] += diffframetime * this.changeBate;
					if(this.r[i] > this.radius){
						this.status[i] = false;
						break;
					}
					var alpha = 1 - this.r[i] / this.radius;
					if(!this.small){  //大光环
						ctx1.strokeStyle = "rgba(203, 91, 0, "+ alpha +")";
					}else{
						ctx1.strokeStyle = "rgba(255, 255, 255, "+ alpha +")";
					}
					ctx1.beginPath();
					// arc(x坐标, y坐标, 半径, 起始角度, 终止角, 顺/逆时针);
					ctx1.arc(this.x[i], this.y[i], this.r[i], 0, 2 * Math.PI);   //画圆，
					ctx1.stroke();
				}
			}
			ctx1.restore();
		}

		this.born = function(index){  //生出一个圆圈
			for(var i=0; i<this.num; i++){
				if(!this.status[i]){  //未被使用
					this.status[i] = true; //设置未使用状态
					if(!this.small){  //大光环
						this.x[i] = smallFish.x;
						this.y[i] = smallFish.y;
					}else{
						this.x[i] = fruit.x[index];
						this.y[i] = fruit.y[index];
					}
					this.r[i] = 10;
					return false;  //结束
				}
			}
		}
	}
	
	/***********漂浮物类****************/
	function DustObj(){
		this.x = [];
		this.y = [];
		this.amp = [];  //振幅
		this.NO = [];  //编号
		this.beat = 0; //sin角度
		this.num = 30;  //漂浮物数目

		this.init = function(){
			this.beat = 0; //sin角度
			for(var i=0; i<this.num; i++){
				this.x[i] = Math.floor(Math.random() * canvas_w);
				this.y[i] = Math.floor(Math.random() * canvas_h);
				this.amp[i] = 20 + Math.random() *25;
				this.NO[i] = Math.floor(Math.random()* 7);
			}
		}

		this.draw = function(){
			this.beat += diffframetime * 0.0008;
			var l = Math.sin(this.beat);
			for(var i=0; i<this.num; i++){
				let no = this.NO[i];
				let baidong = l* this.amp[i]; //摆动量
				ctx1.drawImage(dustPic[no], this.x[i] +baidong, this.y[i]);
			}
		}
	}

	//开始
	burtyang.startGame();
})();